package com.situ.mall.web.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * Web配置类
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    /**
     * 配置静态资源处理
     * 将/assets/**路径映射到实际的静态资源目录
     */
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 将 /assets/** 映射到 classpath:/static/
        registry.addResourceHandler("/assets/**")
                .addResourceLocations("classpath:/static/");
                
        // 确保默认的静态资源映射正常工作
        registry.addResourceHandler("/**")
                .addResourceLocations("classpath:/static/");
    }
} 